package com.proton.carepatchtemp.utils.net;


import com.apkfuns.logutils.LogUtils;
import com.proton.carepatchtemp.R;
import com.proton.carepatchtemp.application.VCare;
import com.proton.carepatchtemp.utils.ApiUtils;
import com.proton.carepatchtemp.utils.NetUtils;
import com.sdsmdg.tastytoast.TastyToast;

/**
 * Created by Api on 2016/9/21.
 */

public class DataCenter {

    protected static final String RET_S = "SUCCESS";
    protected static final String RET_F = "FAIL";

    public static boolean isSuccess(String ret) {
        return RET_S.equalsIgnoreCase(ret);
    }

    public static boolean noNet() {
        boolean noNet = NetUtils.noNet();
        if (noNet) {
            // TODO: 2016/9/22 SMsg
            //SMsg.msg(R.string.no_net);
            try {
                TastyToast.makeText(VCare.get(), VCare.get().getString(R.string.have_no_netconnect), TastyToast.LENGTH_SHORT, TastyToast.ERROR);
            } catch (Exception e) {
                LogUtils.e(e);
                return noNet;
            }

            LogUtils.e("无网络情况");
        }
        return noNet;
    }

    public static long getUid() {
        return VCare.get().getUid();
    }

    public static String getApi(String getlist) {
        return ApiUtils.getServer() + getlist;
    }

}
